const http = require("../../http/http")
Page({
  data: {
    movie: [],
    autoplay: true,
    interval: 3000,
    duration: 1200,
    data: []
  },
  onLoad: function (option) {
    var url = `http://localhost:4000/api/top250`
    http({
      url,
      success: res => {
        var movie = res.data
        console.log(movie)
        this.setData({
          movie
        })
      }
    })
    var data = `http://127.0.0.1:4000/api/banner`
    http({
      url: data,
      success: res => {
        console.log(res);
        var data = res.data
        this.setData({
          data
        })
      }
    })
  },
  handleClick(event) {
    console.log(event.currentTarget.dataset)
    var { aid } = event.currentTarget.dataset
    wx.navigateTo({
      url: `/pages/detail/detail?id=${aid}`
    })
  },
})